/*
* =====================================================================================
*
*       Filename:  gdbus_server.h
*
*    Description:
*
*        Version:  1.0
*        Created:  10/31/2017 10:11:19 AM
*       Revision:  none
*       Compiler:  gcc
*
*         Author:  qiaotsh (), qiaotsh@neusoft.com
*   Organization:  www.neusoft.com
*
* =====================================================================================
*/
#ifndef __OFPRINT_SERVER_H_
#define __OFPRINT_SERVER_H_

#include"ofprint-generated.h"

typedef struct _Ofprint2686 OfprintSkeleton;
#define ofprintx_complete_claim ofprint2686_complete_claim
#define ofprintx_complete_enroll ofprint2686_complete_enroll
#define ofprintx_complete_stop_enroll ofprint2686_complete_stop_enroll
#define ofprintx_complete_verify ofprint2686_complete_verify
#define ofprintx_complete_stop_verify ofprint2686_complete_stop_verify
#define ofprintx_complete_delete_finger ofprint2686_complete_delete_finger
#define ofprintx_complete_delete_all_fingers ofprint2686_complete_delete_all_fingers
#define ofprintx_complete_list_fingers ofprint2686_complete_list_fingers
#define ofprintx_complete_rename_finger ofprint2686_complete_rename_finger
#define ofprintx_complete_identify_with_multiple_user ofprint2686_complete_identify_with_multiple_user
#define ofprintx_emit_enroll_status ofprint2686_emit_enroll_status
#define ofprintx_emit_verify_status ofprint2686_emit_verify_status
#define ofprintx_emit_touch ofprint2686_emit_touch
#define ofprintx_emit_identify_with_multiple_user_status ofprint2686_emit_identify_with_multiple_user_status
#define ofprintx_set_state ofprint2686_set_state
#define ofprintx_skeleton_new ofprint2686_skeleton_new
#define ofprintx_set_name ofprint2686_set_name
#define ofprintx_set_type_ ofprint2686_set_type_
#define ofprintx_set_capability ofprint2686_set_capability



#define DRIVER_VERSION_MAJOR    0
#define DRIVER_VERSION_MINOR    0
#define DRIVER_VERSION_FUNCTION 9



#define OMS_GDBUS_OFP_BUS_TYPE  G_BUS_TYPE_SYSTEM //SESSION
#define OMS_GDBUS_OFP_BUS_NAME  "com.oms.Ofprint2686"
#define OMS_GDBUS_OFP_OBJECT_PATH   "/com/oms/Ofprint2686"

#define OFPRINT_DEVICE_NAME         "ofp2686"
#define OFPRINT_DEVICE_FULL_NAME    "OMS OFP2686"

//#define OFP_VERIFY_TIMES_MAX  5//最大验证次数

#define OFP_DEBUG_MODE_FLAG 1234
#define OFP_USER_MODE_FLAG  1

#define OFP_SET_REBOOT_FLAG 2345



typedef void (*OFP_ENROLL_STATUS_CALLBACK)(char *id, int code, char *msg);
typedef void (*OFP_VERIFY_STATUS_CALLBACK)(char *id, int code, char *msg);
typedef void (*OFP_TOUCH_CALLBACK)(char *id, gboolean pressed);
typedef void (*OFP_IDENTIFY_WITH_MULTIPLE_USER_STATUS_CALLBACK)(char *uuid);


 
#define GDBUS_API  __attribute__((visibility("hidden")))

//指纹设备状态
typedef enum _OFP_DEV_STATE_ENUM_
{
    DeviceStateNormal = 1 << 0, // 设备正常可用
    DeviceStateClaimed = 1 << 1, // 设备被独占
}OFP_DEV_STATE_ENUM;

//指纹设备类型
typedef enum _OFP_DEV_TYPE_ENUM_
{
    DeviceTypeUnknown = 0, // 未知类型
    DeviceTypeScanning, // 扫描式指纹设备
    DeviceTypeTouch, // 触摸式指纹设备
}OFP_DEV_TYPE_ENUM;

//指纹设备特性
typedef enum _OFP_DEV_CAPABILITY_ENUM_
{
    DeviceCapAutologin = 1, // 支持指纹一键自动登录
}OFP_DEV_CAPABILITY_ENUM;




//指纹录入状态
typedef enum _OFP_ENROLL_STATUS_ENUM_
{
    OFP_ENROLL_STATUS_SUCCESS =0,
    OFP_ENROLL_STATUS_FAILED = 1,
    OFP_ENROLL_STAGE_PASSED = 2,
    OFP_ENROLL_STAGE_RETRY =3,  //重新录入
    OFP_ENROLL_STAGE_DISCONNECTED = 4,  //设备失联
}OFP_ENROLL_STATUS_ENUM;

//指纹验证重试子状态
typedef enum _OFP_ENROLL_RETRY_SUBCODE_ENUM_
{
    OFP_ENROLL_TOUCH_TOO_SHORT = 1,//接触时间过短
    OFP_ENROLL_IMG_CANT_USE = 2,    //图形不可用
    OFP_ENROLL_POSITION_REPEATED = 3,   //两次触摸的指纹信息重复率过高
    OFP_ENROLL_FPRINT_ALREADY_EXIST = 4,//当前指纹已经存在，请换其他的手指
    OFP_ENROLL_SWIPE_TOO_SHORT = 5,//滑动太短
    OFP_ENROLL_FINGER_NOT_CENTERED = 6, //手指不在中间
    OFP_ENROLL_REMOVE_AND_RETRY = 7,    //拿开手指再重新扫描
}OFP_ENROLL_RETRY_SUBCODE_ENUM;


//指纹验证状态
typedef enum _OFP_VERIFY_STATUS_ENUM_
{
    OFP_VERIFY_STATUS_MATCH =0,
    OFP_VERIFY_STATUS_NOMATCH = 1,
    OFP_VERIFY_STAGE_ERROR = 2,
    OFP_VERIFY_STAGE_RETRY =3,  //重新验证
    OFP_VERIFY_STAGE_DISCONNECTED = 4,  //设备失联
}OFP_VERIFY_STATUS_ENUM;

//指纹验证重试子状态
typedef enum _OFP_VERIFY_RETRY_SUBCODE_ENUM_
{
    OFP_VERIFY_SWIPE_TOO_SHORT =1,//滑动太短
    OFP_VERIFY_FINGER_NOT_CENTERED = 2,//手指不在中间
    OFP_VERIFY_REMOVE_AND_RETRY = 3,//  拿开手指重新扫描
    OFP_VERIFY_TOUCH_TOO_SHORT = 4, //手指按压时间过短
    OFP_VERIFY_QUALITY_BAD = 5, //图像质量太差
}OFP_VERIFY_RETRY_SUBCODE_ENUM;



 
GDBUS_API void GBusAcquired_Callback (GDBusConnection *connection,
    const gchar *name,
    gpointer user_data);
 
GDBUS_API void GBusNameAcquired_Callback (GDBusConnection *connection,
    const gchar *name,
    gpointer user_data);
 
GDBUS_API void GBusNameLost_Callback (GDBusConnection *connection,
    const gchar *name,
    gpointer user_data);

extern int ofp_set_dev_state(uint8 state);
extern int set_printf_log_grade(int flag);



 
#endif

